<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>Hello World</h1>
<div id="app" style="width: 500px;height: 300px;background-color: gainsboro">
</div>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"/>
<script>
    const axios = axios.create({
        baseURL: 'http://localhost:8080/',
        timeout: 100000000,
        responseType: 'stream',
        onDownloadProgress: function (progressEvent) {
            console.log(progressEvent.event.currentTarget.responseText);
            document.getElementById('app').innerHTML = progressEvent.event.currentTarget.responseText;
        }
    });
    axios.get('/hello/sse')
        .then(function (response) {
            // 处理成功情况
            console.log(response);
        })
        .catch(function (error) {
            // 处理错误情况
            console.log(error);
        })
        .finally(function () {
            // 总是会执行
        });
</script>
</body>
</html>